package net.dntuan.training.spring.mvc;

import java.security.Principal;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "api")
public class ProtectedResourceController {

	@RequestMapping(value = "user/message")
	@ResponseBody
	public String getGreeting(Principal principal) {
		return "hello " + (principal == null ? "" : principal.getName());
	}
}
